local sk__suyin = fk.CreateSkill {

  name = "sk__suyin",

  tags = {  },

}



sk__suyin:addEffect(fk.AfterCardsMove, {
  anim_type = "control",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(sk__suyin.name) and player:isKongcheng() then
      for _, move in ipairs(data) do
        if move.from == player then
          for _, info in ipairs(move.moveInfo) do
            if info.fromArea == Card.PlayerHand then
              return true
            end
          end
        end
      end
    end
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local to = room:askForChoosePlayers(player, table.map(room.alive_players, Util.IdMapper), 1, 1,
      "#sk__suyin-choose", sk__suyin.name, true)
    if #to > 0 then
      event:setCostData(self, to[1])
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = room:getPlayerById(event:getCostData(self))
    to:turnOver()
    if not to.dead and to:isWounded() and to.faceup then
      room:recover({
        who = to,
        num = to:getLostHp(),
        recoverBy = player,
        skillName = sk__suyin.name,
      })
    end
  end,
})

return sk__suyin